<template>
  <view class="pdv40">
    <template v-if="options.length > 0">
      <view class="news flex flex-wrap">
        <view class="news-item" v-for="(item, index) in options" :key="index" @click="$u.route({
          url: '/pages-details/news/detail',
          params: {
            id: item.tmn_id
          }
        })">
          <image
            class="news-item__img flex"
            :src="getImgUrl(item.tmn_icon)"
            mode="aspectFill"
          ></image>

          <view class="news-item__desc">
            <view class="c333 font28 desc-text">{{ item.tmn_title }} </view>
            <view class="c999 font24 mgt20">{{
              $timeFilter(item.tmn_add_time_format, "YYYY/MM/DD")
            }}</view>
          </view>
        </view>
      </view>
    </template>

    <view v-else style="padding: 40rpx 0;">
      <m-empty ></m-empty>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    options: {
      type: Array,
      default: () => [],
    },
  },
};
</script>


<style lang="scss" scoped>
.news-item {
  box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(72, 30, 193, 0.1);
  border-radius: 20rpx;
  overflow: hidden;
  margin-right: 20rpx;
  background-color: white;
  width: calc((100% - 20rpx) / 2);
  flex-shrink: 0;

  &:nth-child(2n) {
    margin-right: 0;
  }

  &:nth-child(n + 3) {
    margin-top: 20rpx;
  }

  &__img {
    height: 188rpx;
    width: 100%;
  }

  &__desc {
    padding: 20rpx;
  }
}

.desc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
</style>